package com.qianli.cashmama.product.facade.result;

import com.alibaba.fastjson.annotation.JSONField;
import com.fqgj.common.utils.CollectionUtils;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by xuyang on 2017/7/20.
 */
public class Product implements Serializable {

    //产品编码
    private String code;

    //本金
    private String principalMoney;

    //实际到账金额
    private String arrivalMoney;

    //还款周期天数 比如，每一个月还一次钱，则周期单位是:月，paybackPeriodLength = 1
    private Integer paybackPeriodLength;

    //还款周期数，比如，分3期还钱，则totalPayBackPeriodCount = 3
    private Integer totalPaybackPeriodCount;

    //服务费（前置服务费 + 税费）
    private String serviceCharge;

    //前置服务费
    private String preServiceCharge;

    //税费
    private String gstCharge;

    //一次性登机费
    private String oneTimeOnBoardingFee;

    //逾期服务费
    private String overdueServiceCharge;

    //利息费率
    private String rate;

    //罚息费率
    private String penaltyRate;

    //服务费率
    private String serviceFeeRate;

    //产品规则
    private List<ProductRuleDetail> productRules;

    //产品所属类目
    private ProductCategory productCategory;

    /**
     * 货架类型 针对不同类目可以有不同的含义 1-默认
     */
    private Integer shelfType;

    //产品协议，一个url
    private String protocol;

    //产品logo url
    private String logo;

    //产品是否有效, true有效, false无效
    private Boolean active;

    // app端是否展示
    private String showFlag;
    /**
     * 产品风险等级
     */
    private Integer riskLevel;
    /**
     * 产品配置 json格式
     */
    private ProductConfig config;

    @JSONField(serialize = false)
    public List<ProductRuleDetail> getAllRules() {
        List<ProductRuleDetail> allProductRules = new ArrayList<>();
        if (CollectionUtils.isNotEmpty(productRules)) {
            allProductRules.addAll(this.productRules);
        }
        if (CollectionUtils.isNotEmpty(this.productCategory.getProductRules())) {
            allProductRules.addAll(this.productCategory.getProductRules());
        }
        return allProductRules;
    }


    public String getCode() {
        return code;
    }

    public Product setCode(String code) {
        this.code = code;
        return this;
    }

    public String getPrincipalMoney() {
        return principalMoney;
    }

    public Product setPrincipalMoney(String principalMoney) {
        this.principalMoney = principalMoney;
        return this;
    }

    public String getArrivalMoney() {
        return arrivalMoney;
    }

    public Product setArrivalMoney(String arrivalMoney) {
        this.arrivalMoney = arrivalMoney;
        return this;
    }

    public Integer getPaybackPeriodLength() {
        return paybackPeriodLength;
    }

    public Product setPaybackPeriodLength(Integer paybackPeriodLength) {
        this.paybackPeriodLength = paybackPeriodLength;
        return this;
    }

    public Integer getTotalPaybackPeriodCount() {
        return totalPaybackPeriodCount;
    }

    public Product setTotalPaybackPeriodCount(Integer totalPaybackPeriodCount) {
        this.totalPaybackPeriodCount = totalPaybackPeriodCount;
        return this;
    }

    public String getServiceCharge() {
        return serviceCharge;
    }

    public Product setServiceCharge(String serviceCharge) {
        this.serviceCharge = serviceCharge;
        return this;
    }

    public String getOverdueServiceCharge() {
        return overdueServiceCharge;
    }

    public Product setOverdueServiceCharge(String overdueServiceCharge) {
        this.overdueServiceCharge = overdueServiceCharge;
        return this;
    }

    public String getRate() {
        return rate;
    }

    public Product setRate(String rate) {
        this.rate = rate;
        return this;
    }

    public String getPenaltyRate() {
        return penaltyRate;
    }

    public Product setPenaltyRate(String penaltyRate) {
        this.penaltyRate = penaltyRate;
        return this;
    }

    public List<ProductRuleDetail> getProductRules() {
        return productRules;
    }

    public Product setProductRules(List<ProductRuleDetail> productRules) {
        this.productRules = productRules;
        return this;
    }

    public ProductCategory getProductCategory() {
        return productCategory;
    }

    public Product setProductCategory(ProductCategory productCategory) {
        this.productCategory = productCategory;
        return this;
    }

    public Integer getShelfType() {
        return shelfType;
    }

    public Product setShelfType(Integer shelfType) {
        this.shelfType = shelfType;
        return this;
    }

    public String getProtocol() {
        return protocol;
    }

    public Product setProtocol(String protocol) {
        this.protocol = protocol;
        return this;
    }

    public String getLogo() {
        return logo;
    }

    public Product setLogo(String logo) {
        this.logo = logo;
        return this;
    }

    public Boolean getActive() {
        return active;
    }

    public Product setActive(Boolean active) {
        this.active = active;
        return this;
    }

    public String getShowFlag() {
        return showFlag;
    }

    public Product setShowFlag(String showFlag) {
        this.showFlag = showFlag;
        return this;
    }

    public String getServiceFeeRate() {
        return serviceFeeRate;
    }

    public Product setServiceFeeRate(String serviceFeeRate) {
        this.serviceFeeRate = serviceFeeRate;
        return this;
    }

    public Integer getRiskLevel() {
        return riskLevel;
    }

    public Product setRiskLevel(Integer riskLevel) {
        this.riskLevel = riskLevel;
        return this;
    }

    public String getPreServiceCharge() {
        return preServiceCharge;
    }

    public Product setPreServiceCharge(String preServiceCharge) {
        this.preServiceCharge = preServiceCharge;
        return this;
    }

    public String getGstCharge() {
        return gstCharge;
    }

    public Product setGstCharge(String gstCharge) {
        this.gstCharge = gstCharge;
        return this;
    }

    public ProductConfig getConfig() {
        return config;
    }

    public Product setConfig(ProductConfig config) {
        this.config = config;
        return this;
    }

    public String getOneTimeOnBoardingFee() {
        return oneTimeOnBoardingFee;
    }

    public void setOneTimeOnBoardingFee(String oneTimeOnBoardingFee) {
        this.oneTimeOnBoardingFee = oneTimeOnBoardingFee;
    }
}
